package cn.kxm.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.kxm.util.MakeNewCode;

import com.alibaba.fastjson.JSON;

@Controller
@RequestMapping("makecode")
public class MakeNewCodeController {
	@Autowired
	private MakeNewCode mn;
	
	
	@RequestMapping("makeNewCode")
	@ResponseBody
	public Object makeNewCode(String prefix){
		Map<String, Object> map=new HashMap<String, Object>();
		String code=mn.getRandomCodeByPrefix(prefix);
		map.put("result", code);
		return JSON.toJSONString(map);
	} 
}
